import request from './request'; // 引入封装的 axios 实例

// 获取老人档案
export const fetchElderlyProfile = (id) => {
  return request.get(`/elderly/${id}`);
};

// 更新老人档案
export const updateElderlyProfile = (id, data) => {
  return request.put(`/elderly/${id}`, data);
};

// 获取绑定关系列表（带搜索参数）
export const fetchRelationships = (params) => {
  return request.get('/binding', { params });
};

// 获取老人绑定家属列表
export const fetchElderlyRelationships = (elderlyUserId, page, size) => {
  return request.get(`/binding/elderly/list`, {
    params: {
      elderlyUserId,
      page,
      size,
    },
  });
};

// 删除绑定关系
export const deleteRelationship = (id) => {
  return request.delete(`/binding/admin/${id}`);
};